[FEATURE] Add support of heterogeneous entities in batch renderer.#2960
Merged
duburcqa merged 11 commits intoJul 13, 2026
Merged
Conversation
Collaborator
Author
Collaborator
Author
video_old.mp4video_new.mp4 |
Kashu7100
marked this pull request as ready for review
June 17, 2026 01:33
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 12d4450d45
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Heterogeneous entities (objects whose geometry variant only exists in a subset of environments) were drawn in every environment by the Madrona batch renderer. Unlike the pyrender path fixed in Genesis-Embodied-AI#2958, the Madrona retriever already feeds dense per-env poses (`vgeoms_state.pos` -> [num_worlds, num_vgeoms]) and never compacts them, so the poses were already aligned -- the missing piece was per-environment visibility. `GenesisGeomRetriever.retrieve_rigid_meshes_static` now emits an optional `geom_env_mask` of shape [num_worlds, num_vgeoms] (1 = visible, 0 = hidden) built from each vgeom's `active_envs_mask`. This is the Madrona analog of the `active_envs` mask added to the pyrender rasterizer in Genesis-Embodied-AI#2958. The mask is omitted for homogeneous scenes, preserving legacy behavior and keeping back-compat with Madrona builds that do not yet accept it. Requires the matching gs-madrona change that consumes `geom_env_mask` (Genesis-Embodied-AI/gs-madrona#53). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Kashu7100
force-pushed
the
fix/madrona-heterogeneous-env
branch
from
June 17, 2026 01:39
12d4450 to
e3f8641
Compare
|
🔴 Benchmark Regression Detected ➡️ Report |
Collaborator
Author
|
Now Genesis-Embodied-AI/gs-madrona#53 is landed. |
The retriever must emit geom_env_mask matching each vgeom's active_envs_mask (correct shape/dtype/column alignment, each env seeing exactly one heterogeneous variant) and omit the key entirely for homogeneous scenes, since the args dict is splatted verbatim into the MadronaBatchRenderer constructor. Verified to fail with KeyError without the batch_renderer.py fix and pass with it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The heterogeneous per-env visibility mask is forwarded verbatim to MadronaBatchRenderer, whose constructor only accepts geom_env_mask from gs-madrona 0.0.8 (Genesis-Embodied-AI/gs-madrona#53); older wheels raise TypeError when building any heterogeneous scene with the batch renderer. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Removed comment about gs-madrona version requirement.
Collaborator
Author
|
gs-madrona 0.0.8 has been released. |
…neous render test The white-box test_heterogeneous_geom_env_mask_for_batch_renderer only inspected the geom_env_mask array the retriever emits; it never rendered, so it could not catch a break in the actual Madrona render path. Replace it with test_madrona_renders_heterogeneous_entities, an end-to-end regression that renders a heterogeneous entity (sphere in some envs, duck mesh in others) plus a homogeneous box through both Madrona backends and pixel-matches each per-env frame against a captured PNG snapshot (ground truth hosted on the HF snapshots dataset). It also asserts the homogeneous box renders in every env and that the duck variant does not leak into the envs it is not active in. Note: requires the ground-truth PNGs to be uploaded to the HF snapshots dataset and HUGGINGFACE_SNAPSHOT_REVISION bumped accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
duburcqa
requested changes
Jul 11, 2026
Merge test_rasterizer_renders_heterogeneous_entities and test_madrona_renders_heterogeneous_entities into a single test_renders_heterogeneous_entities parametrized over RASTERIZER, BATCHRENDER_RASTERIZER and BATCHRENDER_RAYTRACER (mirroring test_render_api_advanced), removing the duplication and the misleading "madrona vs rasterizer" split. The rasterizer composites all envs into one image (env_idx == -1) while the batch renderer returns one image per env; the test branches on that but asserts the same per-env visibility for every backend: the homogeneous box renders everywhere, the duck variant never leaks into envs it is inactive in (masked out entirely when unbatched), and each frame pixel-matches its captured snapshot. Note: snapshot names changed with the rename/reparametrization; the GT PNGs must be (re)uploaded to the HF snapshots dataset and HUGGINGFACE_SNAPSHOT_REVISION bumped accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🔴 Benchmark Regression Detected ➡️ Report |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Heterogeneous entities — objects whose geometry variant only exists in a subset of environments — were drawn in every environment by the Madrona batch renderer. This is the Madrona-path counterpart to #2958, which fixed the same class of bug in the pyrender rasterizer.
Root cause (and why it differs from #2958)
The pyrender fix in #2958 had two parts: (a) stop compacting per-env poses, and (b) add a per-
(primitive, env)active_envsvisibility mask.The Madrona retriever (
GenesisGeomRetriever.retrieve_rigid_state_torch) already feeds dense per-env poses —vgeoms_state.postransposed to[num_worlds, num_vgeoms]— and never compacts them, so part (a) is already correct here. The only missing piece is part (b): per-environment visibility. Without it, a variant vgeom that exists only in envs X, Y is still drawn in all worlds (the Madrona renderer draws every geom in every world).Change
GenesisGeomRetriever.retrieve_rigid_meshes_staticnow emits an optionalgeom_env_maskof shape[num_worlds, num_vgeoms](1= visible,0= hidden), built from each vgeom's existingactive_envs_mask(None⇒ active in all envs). This is the direct Madrona analog of theactive_envsmask added to the pyrender rasterizer in #2958.(world, geom)entries are simply masked out and never drawn / never enter the BVH.Dependency
Requires the matching renderer-side change in gs-madrona that consumes
geom_env_mask: Genesis-Embodied-AI/gs-madrona#53 (adds the optionalgeom_env_maskkwarg → per-(world, geom)renderable disable). With an older gs-madrona, the mask is only emitted for heterogeneous scenes, so homogeneous workloads are unaffected; heterogeneous scenes need both PRs.Testing / follow-up
py_compileclean; pre-commit (ruff) passes.test_render-style test mirroringtest_rasterizer_renders_heterogeneous_entitiesfrom [BUG FIX] Render each heterogeneous variant in its own environment. #2958 but driving the batch renderer (assert a variant only covers pixels in its active envs). Happy to add it.Note
Draft — opened for review of the approach alongside gs-madrona#53.
🤖 Generated with Claude Code